package com.demo;

/**
 * 类部类方式(线程安全)
 * @author ytj
 * @date 2022/2/21
 */
public class Single4 {

    private static class SingletonHolder{
        private static Single4 instance=new Single4();
    }

    private Single4(){

    }

    public static Single4 getInstance(){
        return SingletonHolder.instance;
    }

}
